#include <iostream>

class Person
{

    friend std::ostream &operator<<(std::ostream &os, const Person &p);

private:
    std::string name;
    int age;
    std::string gender;
    int *score;

public:
    Person() : name("user"), age(0), gender("male"), score(0) {}
    Person(std::string name, int age, std::string gender, int score) : name(name), age(age), gender(gender), score(new int(score)) {}
};
// std::ostream << Person
std::ostream &operator<<(std::ostream &os, const Person &p)
{
    os << "name = " << p.name << ", age = " << p.age << ", gender = " << p.gender << ", score = " << *p.score; // 因为这些属性都是私有属性，如果需要访问的话，需要加上这个函数为Person类的友元
    return os;
}

int main(int argc, char const *argv[])
{
    Person lucy("lucy", 18, "femle", 99);
    std::cout << lucy << std::endl;

    Person lutong99 = Person("lutong99", 25, "male", 354);
    std::cout << lutong99 << std::endl;

    return 0;
}
